<?php
/* @var $this SiteController */

$this->pageTitle=Yii::app()->name;

$connection = Yii::app()->db;
$sql = "SELECT COUNT(*) AS 'pagecount', COUNT(*) AS 'usercount' FROM hitcounter GROUP BY page, ip;";
$command = $connection->createCommand($sql);;
$rows = $command->queryAll();
?>

<div id="vitrine">
    <div class="hitcounter">
        <?php
            foreach ($rows as $key => $value){
                echo "<div class='page'><div>Pagine visitate</div><div>".$value['pagecount']."</div></div>\n";
                echo "<div class='user'><div>Visite al sito</div><div>".$value['usercount']."</div></div>\n";
            }
        ?>
    </div>
</div>